package com.qdc.datacenters.client;

import com.dtflys.forest.annotation.*;
import com.qdc.datacenters.domain.query.qw.QwCustomerQuery;
import com.qdc.datacenters.domain.query.qw.QwGroupChatStatisticQuery;
import com.qdc.datacenters.domain.query.qw.QwGroupDetailQuery;
import com.qdc.datacenters.domain.query.qw.QwUserBehaviorDataQuery;
import com.qdc.datacenters.domain.vo.qw.QwCustomerDetailVo;
import com.qdc.datacenters.domain.vo.qw.QwGroupChatStatisticVo;
import com.qdc.datacenters.domain.vo.qw.QwGroupDetailVo;
import com.qdc.datacenters.domain.vo.qw.QwUserBehaviorDataVo;
import com.qdc.datacenters.handler.QwCommonRetryWhenHandler;
import com.qdc.datacenters.interceptor.forest.AgentAccessTokenInterceptor;

/**
 * @author danmo
 * @Description 客户接口
 * @date 2024/02/29 16:46
 **/

@BaseRequest(baseURL = "${qwServerUrl}", interceptor = AgentAccessTokenInterceptor.class)
@Retry(maxRetryCount = "3", maxRetryInterval = "1000", condition = QwCommonRetryWhenHandler.class)
public interface CorpCustomerClient {

    /**
     * 根据客户id获取客户详情
     *
     * @param query
     * @return QwCustomerDetailVo
     */
    @Get(url = "/externalcontact/get?external_userid=${query.external_userid}")
    QwCustomerDetailVo getCustomerDetail(@Var("query") QwCustomerQuery query);

    /**
     * 获取客户群详情
     *
     * @param query
     * @return QwGroupDetailVo
     */
    @Post(url = "/externalcontact/groupchat/get")
    QwGroupDetailVo getGroupChatDetail(@JSONBody QwGroupDetailQuery query);

    /**
     * 联系客户统计
     *
     * @param query
     * @return
     */
    @Request(url = "/externalcontact/get_user_behavior_data", type = "POST")
    QwUserBehaviorDataVo getUserBehaviorData(@JSONBody QwUserBehaviorDataQuery query);

    /**
     * 群聊数据统计（按群主聚合的方式）
     *
     * @param query
     * @return
     */
    @Request(url = "/externalcontact/groupchat/statistic", type = "POST")
    QwGroupChatStatisticVo getGroupChatStatistic(@JSONBody QwGroupChatStatisticQuery query);

    /**
     * 群聊数据统计(按自然日聚合的方式)
     *
     * @param query
     * @return
     */
    @Request(url = "/externalcontact/groupchat/statistic_group_by_day", type = "POST")
    QwGroupChatStatisticVo getGroupChatStatisticGroupByDay(@JSONBody QwGroupChatStatisticQuery query);
}
